Begin

General Control Statement

Syntax samples

BEGIN or {

 

WHILE FREECAP(Loc1) > 5 DO
BEGIN
INC Var2, 5
WAIT 5 sec
END

 

IF Var1 > 5 THEN
{
INC Var2, 5
WAIT 5 sec
}

Description

Defines a statement block with a corresponding END statement. BEGIN and END are almost always used in conjunction with other control statements such as IF...THEN and DO...WHILE. Every BEGIN statement must pair with an END statement.

Valid In

Any logic.

Example

Compare the following logic examples:

The example below includes a BEGIN and END statement. In this logic, if the attribute Attr1 equals one, ten entities are ordered and the variable Var1 increments. ProModel executes the statements within the BEGIN and END only if Attr1 equals one.

IF Attr1 = 1 THEN

BEGIN

ORDER 10 EntA

INC Var1

END

Just as in the logic above, if Attr1 in the following example equals one, ten entities are ordered. However, Var1 increments regardless of the value of Attr1. The IF...THEN applies only to the very next statement, no matter how you format the logic.

IF Attr1 = 1 THEN

ORDER 10 EntA

INC Var1

See Also

END, IF...THEN...ELSE, DO...WHILE, WHILE...DO, and DO...UNTIL.